const Sequelize = require('sequelize');
module.exports = function(sequelize, DataTypes) {
  return sequelize.define('Parent_comments', {
    id: {
      autoIncrement: true,
      type: DataTypes.INTEGER.UNSIGNED,
      allowNull: false,
      primaryKey: true
    },
    postid: {
      type: DataTypes.INTEGER,
      allowNull: false,
      comment: "评论对应的文章id"
    },
    userid: {
      type: DataTypes.INTEGER,
      allowNull: false,
      comment: "评论发布者id"
    },
    content: {
      type: DataTypes.STRING(255),
      allowNull: true,
      comment: "评论内容"
    },
    image_url: {
      type: DataTypes.STRING(255),
      allowNull: true,
      comment: "评论图片路径"
    },
    like: {
      type: DataTypes.STRING(255),
      allowNull: true,
      comment: "点赞量"
    }
  }, {
    sequelize,
    tableName: 'Parent_comments',
    timestamps: true,
    indexes: [
      {
        name: "PRIMARY",
        unique: true,
        using: "BTREE",
        fields: [
          { name: "id" },
        ]
      },
    ]
  });
};
